<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel='icon' href='favicon.ico' type='image/x-icon'>
    <title>大江涂料</title>

</head>
<body>
<div id="app">
    <section id="detail">
        <h3 id="title" style="margin-top: 30px;font-size: 3em;text-align: center"></h3>
        <div id="content" style="margin-left: 10%;margin-right: 10%;"></div>
        <div style="font-size: 1em;margin-left: 5%;font-style: oblique">
            <div style="color: #17278e">
                业务电话：15366683668<br>
                生产厂家：大江装饰涂料厂<br>
                厂址：连云港市灌云县杨集镇
            </div>
        </div>
    </section>
</div>

<script>
    let query = window.location.search.substring(1);
    let id = query.split('=')[1];
    let httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
    httpRequest.open('GET', 'http://zy.zhenyang.work/server/getText?'+query, true);//第二步：打开连接  将请求参数写在url中  ps:"./Ptest.php?name=test&nameone=testone"
    httpRequest.send();//第三步：发送请求  将请求参数写在URL中
    /**
     * 获取数据后的处理程序
     */
    httpRequest.onreadystatechange = function () {
        if (httpRequest.readyState == 4 && httpRequest.status == 200) {
            let json = httpRequest.responseText;//获取到json字符串，还需解析
            let result = JSON.parse(json);
            if (result.success == true){
                document.getElementById('title').innerHTML = result.data.title;
                document.getElementById('content').innerHTML = result.data.content;
            }
        }
    };
</script>

</body>
</html>
